#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMessageBox>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "global.h"
#include <QDebug>
#include <QSqlError>
#include <QSqlTableModel>
#include <QCloseEvent>
#include <QInputDialog>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_btnQuitLogin_clicked();

    void on_btnLoginLogin_clicked();

    void on_btnPassApplyAdmin_clicked();

    void on_btnRefuseApplyAdmin_clicked();

    void on_btnDeleteApplyAdmin_clicked();

    void on_btnResetApplyAdmin_clicked();

    void on_btnSubminApplyAdmin_clicked();

    void on_actApplyAdmin_triggered();

    void on_actGitAdmin_triggered();

    void on_cheEditGitAdmin_stateChanged(int arg1);

    void on_btnResetGitAdmin_clicked();

    void on_btnSubmitGitAdmin_clicked();

    void on_btnAppendGitAdmin_clicked();

    void on_btnDeleteGitAdmin_clicked();

    void on_actBuyAdmin_triggered();

    void on_cheEditBuyAdmin_stateChanged(int arg1);

    void on_btnAppendBuyAdmin_clicked();

    void on_btnDeleteBuyAdmin_clicked();

    void on_btnResetBuyAdmin_clicked();

    void on_btnSubmitBuyAdmin_clicked();

    void on_cheEditUsedAdmin_stateChanged(int arg1);

    void on_btnAppendUsedAdmin_clicked();

    void on_btnDeleteUsedAdmin_clicked();

    void on_btnResetUsedAdmin_clicked();

    void on_btnSubmitUsedAdmin_clicked();

    void on_actUsedAmin_triggered();

    void on_actQuit_triggered();

    void on_btnFindGitAdmin_clicked();

    void on_btnFindUsedAdmin_clicked();

    void on_actLogout_triggered();

    void on_btnAppendResultUser_clicked();

    void on_btnDeleteResultUser_clicked();

    void on_btnResetResultUser_clicked();

    void on_btnSubmitResultUser_clicked();

    void on_actApplyUser_triggered();

    void on_actFixUser_triggered();

    void on_actAbolisUser_triggered();

    void on_btnAppendFixUser_clicked();

    void on_btnDeleteFixUserl_clicked();

    void on_btnResetFixUser_clicked();

    void on_btnSubmitFixUser_clicked();

    void on_btnAppendAbolishUser_clicked();

    void on_btnDeleteAbolishUser_clicked();

    void on_btnResetAbolishUser_clicked();

    void on_btnSubmitAbolihUser_clicked();

    void on_actFixAdmin_triggered();

    void on_actAbolish_triggered();

    void on_btnPassFixAdmin_clicked();

    void on_btnRefuseFixAdmin_clicked();

    void on_btnDeleteFixAdmin_clicked();

    void on_btnResetFixAdmin_clicked();

    void on_btnSubmitFixAdmin_clicked();

    void on_btnPassAbolishAdmin_clicked();

    void on_btnRefuseAbolishAdmin_clicked();

    void on_btnDeleteAbolishAdmin_clicked();

    void on_btnResetAbolishAdmin_clicked();

    void on_btnSubmitAbolishAdmin_clicked();

private:
    Ui::MainWindow *ui;

    //私有成员部分
    QSqlDatabase m_db;//数据库连接对象
    QString m_userAccount;//用户账号
    QString m_userName;//用户姓名
    int m_uerRole;//用户角色,0--普通用户,1--管理员

    //私有函数部分
    void init();//程序初始化函数,程序启动时最先调用的自定义函数
    void adminInit();//进入管理员界面,初始化管理员界面
    void userInit();//进入用户界面,初始化用户界面

protected:
    void closeEvent(QCloseEvent* e);//重写程序退出函数,当程序关闭前先断开数据库连接
};
#endif // MAINWINDOW_H
